﻿using AIStudio.Wpf.Demo01.Models;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AIStudio.Wpf.Demo01.Models
{
    public class SharpBase : BindableBase
    {
        private double _left;
        public double Left
        {
            get { return _left; }
            set { SetProperty(ref _left, value); }
        }

        private double _top;
        public double Top
        {
            get { return _top; }
            set { SetProperty(ref _top, value); }
        }

        private double _width;
        public double Width
        {
            get
            {
                return _width;
            }
            set
            {
                SetProperty(ref _width, value);
            }
        }

        private double _height;
        public double Height
        {
            get
            {
                return _height;
            }
            set
            {
                SetProperty(ref _height, value);
            }
        }

        protected ObservableCollection<FullyPort> _ports = new ObservableCollection<FullyPort>();
        public ObservableCollection<FullyPort> Ports
        {
            get
            {
                return _ports;
            }
        }

        public FullyPort TopPort
        {
            get
            {
                return Ports?.FirstOrDefault(p => p.Orientation == PortOrientation.Top);
            }
        }

        public FullyPort BottomPort
        {
            get
            {
                return Ports?.FirstOrDefault(p => p.Orientation == PortOrientation.Bottom);
            }
        }

        public FullyPort LeftPort
        {
            get
            {
                return Ports?.FirstOrDefault(p => p.Orientation == PortOrientation.Left);
            }
        }

        public FullyPort RightPort
        {
            get
            {
                return Ports?.FirstOrDefault(p => p.Orientation == PortOrientation.Right);
            }
        }

        public SharpBase()
        {
            Ports.Add(new FullyPort() { Orientation = PortOrientation.Left });
            Ports.Add(new FullyPort() { Orientation = PortOrientation.Top });
            Ports.Add(new FullyPort() { Orientation = PortOrientation.Right });
            Ports.Add(new FullyPort() { Orientation = PortOrientation.Bottom });
        }
    }
}
